﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Routing;
using System.Web;
using System.Web.Mvc;
namespace RegisterService
{
    public class AdminRouteUrl
    {
    }
    public class RouteUrl
    {

        public static void Route(RouteCollection routes)
        {
            ///Product
            routes.MapRoute(
                 "product_list", // Route name
                 "product-list", // URL with parameters
                 new { controller = "Product", action = "Index" }
            );
            routes.MapRoute(
                 "category_list", // Route name
                 "product-list/{id}/{Link}.html", // URL with parameters
                 new { controller = "Product", action = "ProductCategory", Id = UrlParameter.Optional, Link = UrlParameter.Optional},
                 new { Id = @"\d+" }// Parameter defaults
             );
            
            routes.MapRoute(
                 "product_details", // Route name
                 "product-detail/{id}/{Link}.html", // URL with parameters
                 new { controller = "Product", action = "Details", id = UrlParameter.Optional, Link = UrlParameter.Optional },
                 new { id = @"\d+" }// Parameter defaults
            );
            ///Article
            routes.MapRoute(
                 "articles_list", // Route name
                 "articles-list", // URL with parameters
                 new { controller = "Article", action = "ListArticle" }
             );
            routes.MapRoute(
                 "categoryarticle_list", // Route name
                 "articles-list/{id}/{Link}.html", // URL with parameters
                 new { controller = "Article", action = "ShowByCateID", id = UrlParameter.Optional, Link = UrlParameter.Optional },
                 new { id = @"\d+" }// Parameter defaults
             );
            routes.MapRoute(
                "article_details", // Route name
                "{id}/{Link}.html", // URL with parameters
                new { controller = "Article", action = "Details", id = UrlParameter.Optional, Link = UrlParameter.Optional },
                new { id = @"\d+" }// Parameter defaults
            );
            
            routes.MapRoute(
                "HomePage", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
        }
    }
}
